Unity 5 Game Optimization by Chris Dickinson

Unity 5 Game Optimization by Chris Dickinson

Author:Chris Dickinson [Dickinson, Chris]
Language: eng
Format: epub, azw3
Publisher: Packt Publishing
Published: 2015-11-05T23:00:00+00:00


Prefer discrete collision detection

We should use the Discrete option by default for the majority of objects. Teleporting objects once and performing a single overlap check between nearby object-pairs is a fairly trivial amount of work. However, the amount of calculation it takes to interpolate the objects between their starting and ending positions, and simultaneously verify any slight bounding-volume overlaps between these points over time, is significantly greater.

Consequently, the Continuous collision detection option is an order of magnitude more expensive than the Discrete detection method, and the ContinuousDynamic collision detection setting is an order of magnitude more expensive than Continuous! Having too many objects of the continuous types will cause serious performance degradation in complex Scenes. In either case, the costs are multiplied by the number of objects that need to be compared during any given frame and whether or not the comparison collider is Static or Dynamic.

Ergo, the continuous detection settings should only be used in extreme circumstances. The Continuous setting should be used when important collisions are frequently missed with the static world, for instance, if we expect certain objects to move quickly, and we wish to be certain they never fall through the game world or teleport through walls. Finally, the ContinuousDynamic setting should only be used if the same situation applies but we wish to catch collisions between pairs of very-fast moving Dynamic Colliders. Unless we have good reason to use them, all other situations should favor the Discrete setting.

But, perhaps, the Discrete setting isn't working well-enough on a large scale. Perhaps our entire game revolves around a lot of small physics objects and discrete collision detection simply isn't catching enough collisions to maintain product quality. Well, we're in luck, because we can customize the physics timestep to give the Discrete collision option a better chance of catching such collisions by modifying how frequently the engine checks for Fixed Updates.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.